package com.jwaoo.mobile.view.register.presenter;

import android.app.Activity;

import com.dx.as.LoadingDialog;
import com.dx.as.listener.IProInterface;
import com.dx.as.listener.IViewInterface;
import com.jwaoo.mobile.view.register.model.RegisterModel;

import java.util.Map;

/**
 * Created by jwaoo on 2017/10/16.
 */

public class RegisterPresenter extends IProInterface {
    private RegisterModel model;
    private IRegisterView iView;

    public RegisterPresenter(Activity activity, IViewInterface iViewInterface) {
        super(activity, iViewInterface);
        model = new RegisterModel(activity.getApplicationContext(),this);
        iView = (IRegisterView)iViewInterface;
    }

    @Override
    public void initialataData() {

    }

    public void doRegister(Map map){
        LoadingDialog.getInstance(getActivity()).show();
        model.doRegister(map);
    }

    public void doSendEmail(Map map){
        LoadingDialog.getInstance(getActivity()).show();
        model.doSendEmail(map);
    }

    @Override
    public void onResponse(Object response, int flg) {
        super.onResponse(response, flg);
        iView.onRegisterSucess();
        iView.onSendEmail();
    }
}
